//@ sourceURL=RelatedPartyProtocolView.js
Ext.ns("RelatedPartyProtocolView");

RelatedPartyProtocolView = Ext.extend(Ext.Panel,{
    constructor : function(a) {
        Ext.applyIf(this, a);
        var all=this.initUIComponents();
        RelatedPartyProtocolView.superclass.constructor.call(this, {
            id : "RelatedPartyProtocolView",
            title : "相关方协议",
            region : "center",
            layout : "border",
            border : false,
            iconCls : "menu-position",
            items : [all.yearGridPanel,all.yearGridSearchPanel,all.yearGridTreePanel]
        });
    },
    initUIComponents : function() {
    var yearGridComponents=new createyeargridview({
        topbar : {
            inputFormName : 'RelatedPartyProtocolForm',
            topbarAdd:{
                hidden:false
            },
            topbarDel:{
                hidden:false
            }
        },
        search : {
            items : [ {
                style : "margin:5px 5px 5px 5px;",
                text : "协议编号"
            }, {
                columnWidth : 0.2,
                xtype : "textfield",
                name : "Q_protocolNo_S_LK",
                maxLength : 256
            } ]
        },
        grid : {
            title : "相关方协议列表",
            rowActions:true,
            listUrl : __ctxPath + "/relatedparty/listRelatedPartyProtocol.do",
            removeUrl : __ctxPath + "/relatedparty/deleteRelatedPartyProtocol.do",
            fields : [ "id", "years", "institution","protocolNo", "protocolName", "relatedType", "relatedName", "signDate","protocolValidity", "protocolContent"],
            columns : [ {
                header : "id",
                dataIndex : "id",
                hidden : true
            },{
                header : "年份",
                dataIndex : "years",
                width : 50,
                hidden : true,
                sortable : true
            },{
                header : "所属机构",
                dataIndex : "institution",
                width:80
            },{
                header : "协议编号",
                dataIndex : "protocolNo",
                width:80
            },{
                header : "协议名称",
                dataIndex : "protocolName",
                width:80
            },{
                header : "相关方类型",
                dataIndex : "relatedType",
                width:70,
                renderer : function(j,i,g,m,h){
                    if(j==1){
                        return "供方";
                    }else if(j==2){
                        return "协作方";
                    }else if(j==3){
                        return "承包方";
                    }else if(j==4){
                        return "其他";
                    }
                }
            },{
                header : "相关方名称",
                dataIndex : "relatedName",
                width:70
            },{
                header : "签订日期",
                dataIndex : "signDate",
                width:80
            },{
                header : "协议有效期",
                dataIndex : "protocolValidity",
                width:100
            },{
                header : "协议内容",
                dataIndex : "protocolContent",
                width:100
            } ]
        },
        tree : {
            treeUrl : __ctxPath + "/relatedparty/treeLoadRelatedPartyProtocol.do"
        }
        
    });
    return yearGridComponents;
}
});
RelatedPartyProtocolView.edit = function(id) {
    new RelatedPartyProtocolForm({
        id : id,
        operation: Constant.Operation.EDIT
    }).show();
};